﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ThoiTrang.Entities;
using ThoiTrang.Business;

public partial class user_profiles : System.Web.UI.Page
{
    public a_User usr;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!SessionManager.IsLogged)
            Response.Redirect("login.aspx?ckid=" + SessionManager.GetCookie(), true);
        usr = a_UserService.Geta_UserBySSID(SessionManager.GetCookie());
        if (IsPostBack)
        {
            usr.Firstname = Request["Firstname"];
            usr.Lastname = Request["Lastname"];
            usr.Login_Email = Request["Login_Email"];
            usr.Password = Request["Password"];
            usr.Gender = Request["Gender"];
            usr.UserTypeID = int.Parse(Request["UserTypeID"]);
            usr.LastVisit = DateTime.Now;
            usr.DateOpen = DateTime.Now;
            try
            {
                a_UserService.Updatea_User(usr);
                InfoText.Visible = true;
            }
            catch (Exception ex)
            {
                Page.Title = ex.Message;
            }
        }
        else
        {
            Form.Attributes.Add("onsubmit", "return CheckUserProfile(this);");
            Form.Method = "post";
        }
    }
}
